package com.ruoyi.equipment.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.equipment.domain.EasEquipment;
import com.ruoyi.equipment.service.IEasEquipmentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 设备清单Controller
 * 
 * @author ruoyi
 * @date 2025-04-01
 */
@RestController
@RequestMapping("/equipment/equipment")
public class EasEquipmentController extends BaseController {
    @Autowired
    private IEasEquipmentService easEquipmentService;

    /**
     * 查询设备清单列表
     */
    @PreAuthorize("@ss.hasPermi('equipment:equipment:list')")
    @GetMapping("/list")
    public TableDataInfo list(EasEquipment easEquipment) {
        startPage();
        List<EasEquipment> list = easEquipmentService.selectEasEquipmentList(easEquipment);
        return getDataTable(list);
    }

    /**
     * 导出设备清单列表
     *//*
    @PreAuthorize("@ss.hasPermi('equipment:equipment:export')")
    @Log(title = "设备清单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EasEquipment easEquipment) {
        List<EasEquipment> list = easEquipmentService.selectEasEquipmentList(easEquipment);
        ExcelUtil<EasEquipment> util = new ExcelUtil<EasEquipment>(EasEquipment.class);
        util.exportExcel(response, list, "设备清单数据");
    }*/

    /**
     * 获取设备清单详细信息
     */
    @PreAuthorize("@ss.hasPermi('equipment:equipment:query')")
    @GetMapping(value = "/{equipmentNo}")
    public AjaxResult getInfo(@PathVariable("equipmentNo") String equipmentNo) {
        return success(easEquipmentService.selectEasEquipmentByEquipmentNo(equipmentNo));
    }

}